//
//  SRTool.m
//  StockpdfReading
//
//  Created by mac on 2017/6/19.
//  Copyright © 2017年 上海LOL信息技术服务有限公司. All rights reserved.
//

#import "SRTool.h"

@implementation SRTool



#pragma mark - 读写删除 -
+ (void)removeValueforKey:(NSString *)key{
    if ([SRTool readValueForKey:key]) {
        [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
    }
}

+ (void)writeValue:(id)value forKey:(NSString *)key{
    [[NSUserDefaults standardUserDefaults]  setObject:[NSKeyedArchiver archivedDataWithRootObject:value] forKey:key];
}

+ (id)readValueForKey:(NSString *)key{
    id obj = [[NSUserDefaults standardUserDefaults] objectForKey:key];
    if (!obj) {
        return nil;
    }
    return [NSKeyedUnarchiver unarchiveObjectWithData:obj];
}


@end
